getListGainsForDateRange

fun getListGainsForDateRange(dateRange: DateRange, selectSalesByTaxDate: Boolean = false): List<CapitalGainResult>

Calculates and then returns a list of individual (simple) CapitalGainResults for all sale txns within the date requested Notes: - the caller should check the status of this cost calculation's isCostBasisInvalid property, along with the status of each returned gain's isValid property to handle invalid capital gains. - Order: when useTaxDate or selectSalesByTaxDate is true the sales are ordered by tax date, then transaction date; sales on the same dates keep this calculation's own order (the sort is stable). Otherwise the gains are in this calculation's own order (transaction date). Either way the unrealised gain (unRealizedSaleTxn), when present, stays last. - Each gain records both options in CapitalGainResult.useTaxDate and CapitalGainResult.selectSalesByTaxDate.

Parameters

dateRange

The date range to select the sales by.

selectSalesByTaxDate

Default false: a sale is selected when its transaction date falls within dateRange. When true: a sale is selected when its tax date falls within dateRange, whatever its transaction date. Sales dated after the range end are then read up to this calculation's as-of date only, so the caller must build the calculation to a late enough as-of date (refer deriveTxnDateRangesForTaxDates). Requires useTaxDate and no unRealizedSaleTxn: throws IllegalArgumentException when true and this calculation was built without useTaxDate, or with an unRealizedSaleTxn. The parameter was added @since MD2027